<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<head>
<title>Market place</title>
</head>
<f:view>
	<body>
		<ui:composition template="/templates/adminTemplate.xhtml">
			<ui:define name="content">

				<div id="center">

					<h:form prependId="false" id="detailForm">
						<h:panelGrid columns="1">
							<h:panelGrid columns="3" style="width:100%; font-size:0.9em;">
								<p:commandButton ajax="true" value="Reload"
									update=":detailForm:reportTabView:orderedSummaryTable,:detailForm:reportTabView:confirmedSummaryTable,:detailForm:reportTabView:deliveredSummaryTable,:detailForm:reportTabView:orderPreparedSummaryTable,:detailForm:reportTabView:inventoryCheckingTable"
									style="float:left"
									actionListener="#{reportController.loadOrderDetailSummaryByProduct}" />

								<h:panelGroup>
									<h:outputText value="Required Date:"></h:outputText>
									<p:calendar value="#{reportModel.orderQuery.requiredDate}" />
								</h:panelGroup>


								<h:outputText
									value="Include all orders,but exclude Canceled Order"></h:outputText>

							</h:panelGrid>
							<p:tabView id="reportTabView" style="font-size:0.9em">
								<p:tab title="Ordered">
									<h:panelGrid columns="1" style="width:100%">
										<h:commandLink value="Print" style="float:right">
											<p:fileDownload
												value="#{reportController.orderPurchaseSummaryPdf}"></p:fileDownload>
										</h:commandLink>
									</h:panelGrid>
									<p:dataTable id="orderedSummaryTable" var="detail" sortBy="1"
										resizableColumns="true"
										value="#{reportModel.orderDetailsSummaryByProducts}"
										paginator="true" rows="50" filterEvent="enter"
										rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,150"
										paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
										<p:column headerText="id" sortBy="#{detail.id}" width="20">
											<h:outputText value="#{detail.id}" style="float:right" />
										</p:column>
										<p:column sortBy="#{detail.number}" width="40">
											<h:outputText value="#{detail.number}" style="float:left" />
										</p:column>

										<p:column sortBy="#{detail.name}" filterBy="#{detail.name}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.name}" />
										</p:column>
										<p:column sortBy="#{detail.chineseName}"
											filterBy="#{detail.chineseName}" filterMatchMode="contains">
											<h:outputText value="#{detail.chineseName}" />
										</p:column>
										<p:column headerText="Ordered Quantity"
											sortBy="#{detail.orderedQuantity}">
											<h:outputText value="#{detail.orderedQuantity}" />
										</p:column>
										<p:column headerText="Purchase Price"
											sortBy="#{detail.purchasePrice}">
											<h:outputText value="#{detail.purchasePrice}" />
										</p:column>
										<p:column headerText="Ordered subTotal"
											sortBy="#{detail.orderedSubtotal}">
											<h:outputText value="#{detail.orderedSubtotal}" />
										</p:column>
										<p:column sortBy="#{detail.type}" filterBy="#{detail.type}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.type}" />
										</p:column>
										<p:column headerText="Price unit" sortBy="#{detail.unit}"
											filterBy="#{detail.unit}" filterMatchMode="contains">
											<h:outputText
												value="#{detail.unit}/#{detail.chineseUnit}/#{detail.frenchUnit}" />
										</p:column>
										<p:column headerText="Spec. Desc." sortBy="#{detail.specDesc}"
											filterBy="#{detail.specDesc}" filterMatchMode="contains">
											<h:outputText value="#{detail.specDesc}" />
										</p:column>
										<p:summaryRow>
											<p:column colspan="6" style="text-align:right">
												<h:outputText value="Total: "></h:outputText>
											</p:column>

											<p:column>
												<h:outputText
													value="#{reportModel.orderDetailSummaryByProductOrderedTotalLabel}"></h:outputText>
											</p:column>
											<p:column colspan="3" style="text-align:right">
											</p:column>
										</p:summaryRow>
									</p:dataTable>
								</p:tab>
								<p:tab title="Confirmed">
									<p:dataTable id="confirmedSummaryTable" var="detail" sortBy="1"
										resizableColumns="true"
										value="#{reportModel.orderDetailsSummaryByProducts}"
										paginator="true" rows="50" filterEvent="enter"
										rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,150"
										paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
										<p:column headerText="id" sortBy="#{detail.id}" width="20">
											<h:outputText value="#{detail.id}" style="float:right" />
										</p:column>
										<p:column sortBy="#{detail.number}" width="40">
											<h:outputText value="#{detail.number}" style="float:left" />
										</p:column>

										<p:column sortBy="#{detail.name}" filterBy="#{detail.name}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.name}" />
										</p:column>
										<p:column sortBy="#{detail.chineseName}"
											filterBy="#{detail.chineseName}" filterMatchMode="contains">
											<h:outputText value="#{detail.chineseName}" />
										</p:column>


										<p:column headerText="Confirmed Quantity"
											sortBy="#{detail.confirmedQuantity}">
											<h:outputText value="#{detail.confirmedQuantity}" />
										</p:column>
										<p:column headerText="Purchase Price"
											sortBy="#{detail.purchasePrice}">
											<h:outputText value="#{detail.purchasePrice}" />
										</p:column>
										<p:column headerText="Confirmed subTotal"
											sortBy="#{detail.confirmedSubtotal}">
											<h:outputText value="#{detail.confirmedSubtotal}" />
										</p:column>
										<p:column sortBy="#{detail.type}" filterBy="#{detail.type}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.type}" />
										</p:column>
										<p:column headerText="Price unit" sortBy="#{detail.unit}"
											filterBy="#{detail.unit}" filterMatchMode="contains">
											<h:outputText
												value="#{detail.unit}/#{detail.chineseUnit}/#{detail.frenchUnit}" />
										</p:column>
										<p:column headerText="Spec. Desc." sortBy="#{detail.specDesc}"
											filterBy="#{detail.specDesc}" filterMatchMode="contains">
											<h:outputText value="#{detail.specDesc}" />
										</p:column>
										<p:summaryRow>
											<p:column colspan="6" style="text-align:right">
													Total: 
													</p:column>

											<p:column>
												<h:outputText
													value="#{reportModel.orderDetailSummaryByProductConfirmedTotalLabel}"></h:outputText>
											</p:column>
											<p:column colspan="3" style="text-align:right">
											</p:column>
										</p:summaryRow>
									</p:dataTable>
								</p:tab>
								<p:tab title="Prepared/Delivered">
									<p:dataTable id="deliveredSummaryTable" var="detail" sortBy="1"
										resizableColumns="true"
										value="#{reportModel.orderDetailsSummaryByProducts}"
										paginator="true" rows="50" filterEvent="enter"
										rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,150"
										paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
										<p:column headerText="id" sortBy="#{detail.id}" width="20">
											<h:outputText value="#{detail.id}" style="float:right" />
										</p:column>
										<p:column sortBy="#{detail.number}" width="40">
											<h:outputText value="#{detail.number}" style="float:left" />
										</p:column>

										<p:column sortBy="#{detail.name}" filterBy="#{detail.name}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.name}" />
										</p:column>
										<p:column sortBy="#{detail.chineseName}"
											filterBy="#{detail.chineseName}" filterMatchMode="contains">
											<h:outputText value="#{detail.chineseName}" />
										</p:column>


										<p:column headerText="Prepared/Delivered QTY"
											sortBy="#{detail.deliveredQuantity}">
											<h:outputText value="#{detail.deliveredQuantity}" />
										</p:column>
										<p:column headerText="Purchase Price"
											sortBy="#{detail.purchasePrice}">
											<h:outputText value="#{detail.purchasePrice}" />
										</p:column>
										<p:column headerText="Prepared/Delivered Sub."
											sortBy="#{detail.deliveredSubtotal}">
											<h:outputText value="#{detail.deliveredSubtotal}" />
										</p:column>
										<p:column sortBy="#{detail.type}" filterBy="#{detail.type}"
											filterMatchMode="contains">
											<h:outputText value="#{detail.type}" />
										</p:column>
										<p:column headerText="Price unit" sortBy="#{detail.unit}"
											filterBy="#{detail.unit}" filterMatchMode="contains">
											<h:outputText
												value="#{detail.unit}/#{detail.chineseUnit}/#{detail.frenchUnit}" />
										</p:column>
										<p:column headerText="Spec. Desc." sortBy="#{detail.specDesc}"
											filterBy="#{detail.specDesc}" filterMatchMode="contains">
											<h:outputText value="#{detail.specDesc}" />
										</p:column>
										<p:summaryRow>
											<p:column colspan="6" style="text-align:right">
													Total: 
													</p:column>

											<p:column>
												<h:outputText
													value="#{reportModel.orderDetailSummaryByProductDeliveredTotalLabel}"></h:outputText>
											</p:column>
											<p:column colspan="3" style="text-align:right">
											</p:column>
										</p:summaryRow>
									</p:dataTable>
								</p:tab>
								<p:tab title="Inventory checking">
									<h:panelGrid cellspacing="10">
										<h:outputText
											value="Use this report Wednesday, Friday, Monday at 10:10 to check inventory"
											style="font-size:1.2;color:red"></h:outputText>
										<p:dataTable id="inventoryCheckingTable" var="detail"
											resizableColumns="trye"
											value="#{reportModel.orderDetailsSummaryByProducts}"
											paginator="true" rows="50" filterEvent="enter"
											rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,150"
											paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
											<p:column headerText="id" sortBy="#{detail.id}" width="20">
												<h:outputText value="#{detail.id}" style="float:right" />
											</p:column>
											<p:column sortBy="#{detail.number}" width="40">
												<h:outputText value="#{detail.number}" style="float:left" />
											</p:column>
											<p:column headerText="location"
												sortBy="#{detail.storageLocation}">
												<h:outputText value="#{detail.storageLocation}" />
											</p:column>

											<p:column sortBy="#{detail.name}" filterBy="#{detail.name}"
												filterMatchMode="contains">
												<h:outputText value="#{detail.name}" />
											</p:column>
											<p:column sortBy="#{detail.chineseName}"
												filterBy="#{detail.chineseName}" filterMatchMode="contains">
												<h:outputText value="#{detail.chineseName}" />
											</p:column>
											<p:column headerText="Website Inv."
												sortBy="#{detail.inventory}">
												<h:outputText value="#{detail.inventory}" />
											</p:column>
											<p:column headerText="Ordered QTY"
												sortBy="#{detail.orderedQuantity}">
												<h:outputText value="#{detail.orderedQuantity}" />
											</p:column>
											<p:column headerText="Difference"
												sortBy="#{detail.orderedDifference}">
												<h:outputText value="#{detail.orderedDifference}" />
											</p:column>
											<p:column headerText="Price unit" sortBy="#{detail.unit}"
												filterBy="#{detail.unit}" filterMatchMode="contains">
												<h:outputText
													value="#{detail.unit}/#{detail.chineseUnit}/#{detail.frenchUnit}" />
											</p:column>
											<p:column headerText="Spec. Desc."
												sortBy="#{detail.specDesc}" filterBy="#{detail.specDesc}"
												filterMatchMode="contains">
												<h:outputText value="#{detail.specDesc}" />
											</p:column>
										</p:dataTable>
									</h:panelGrid>
								</p:tab>
								<p:tab title="Prepare summary">

									<h:panelGrid cellspacing="10px">
										<h:panelGrid columns="2" style="width:100%">
											<h:outputText
												value="Use this report Thursday, Saturday, Tuesday at 10:10 to take out products from fridge"
												style="font-size:1.2;color:red"></h:outputText>
											<h:commandLink value="Print" style="float:right">
												<p:fileDownload
													value="#{reportController.orderPrepareSummaryPdf}"></p:fileDownload>
											</h:commandLink>
										</h:panelGrid>
										<p:dataTable id="orderPreparedSummaryTable" var="detail"
											resizableColumns="true"
											value="#{reportModel.orderDetailsSummaryByProducts}"
											paginator="true" rows="50" filterEvent="enter"
											rowsPerPageTemplate="5,7,10,15,20,30,40,50,100,150"
											paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}">
											<p:column headerText="id" sortBy="#{detail.id}" width="20">
												<h:outputText value="#{detail.id}" style="float:right" />
											</p:column>
											<p:column sortBy="#{detail.number}" width="40">
												<h:outputText value="#{detail.number}" style="float:left" />
											</p:column>
											<p:column headerText="location"
												sortBy="#{detail.storageLocation}">
												<h:outputText value="#{detail.storageLocation}" />
											</p:column>
											<p:column sortBy="#{detail.name}" filterBy="#{detail.name}"
												filterMatchMode="contains">
												<h:outputText value="#{detail.name}" />
											</p:column>
											<p:column sortBy="#{detail.chineseName}"
												filterBy="#{detail.chineseName}" filterMatchMode="contains">
												<h:outputText value="#{detail.chineseName}" />
											</p:column>
											<p:column headerText="WS Inv." sortBy="#{detail.inventory}">
												<h:outputText value="#{detail.inventory}" />
											</p:column>
											<p:column headerText="Cfm. QTY"
												sortBy="#{detail.confirmedQuantity}">
												<h:outputText value="#{detail.confirmedQuantity}" />
											</p:column>
											<p:column headerText="QTY in fridge"
												sortBy="#{detail.deliveredQuantity + detail.inventory}">
												<h:outputText
													value="#{detail.deliveredQuantity + detail.inventory}" />
											</p:column>

											<p:column headerText="Price unit" sortBy="#{detail.unit}"
												filterBy="#{detail.unit}" filterMatchMode="contains">
												<h:outputText
													value="#{detail.unit}/#{detail.chineseUnit}/#{detail.frenchUnit}" />
											</p:column>
											<p:column headerText="Spec. Desc."
												sortBy="#{detail.specDesc}" filterBy="#{detail.specDesc}"
												filterMatchMode="contains">
												<h:outputText value="#{detail.specDesc}" />
											</p:column>
										</p:dataTable>
									</h:panelGrid>

								</p:tab>
							</p:tabView>
						</h:panelGrid>
					</h:form>

				</div>
			</ui:define>
		</ui:composition>
	</body>
</f:view>
</html>